1. Field of Invention
Aspects of the present invention are directed to the processing of compressed digital images, and more particularly to the processing of a compressed digital image in an order that is different than the order in which it was compressed, for example, to rotate the compressed digital image.
2. Discussion of Related Art
The compression and decompression of digital images is well known, as evidenced, for example, by the widespread acceptance of the JPEG (Joint Photographic Experts Group) standard. The JPEG standard is described in numerous publications, such as the JPEG Still Image Data Compression Standard, by W. Pennebaker and J. Mitchell, 1993 (Van Nostrand Reinhold, New York), and thus details of the JPEG standard are described only briefly herein.
In accordance with a baseline mode of operation defined in the JPEG standard, digitally sampled component values of portions of an image are transformed into a frequency domain representation using a DCT (Discrete Cosine Transform). The resultant coefficient values (organized in 8 by 8 “blocks”) for each of the components (e.g., luminance, chrominance) are then quantized (i.e., divided) by a quantization value, and the quantized coefficient values are encoded using an entropy encoding process (either Huffman encoding or arithmetic encoding) to produce a JPEG compressed data stream. In the sequential DCT mode of operation, the quantized coefficient values for the components are separately encoded either individually, or in groups, in a single pass or scan in what are termed Minimum Coded Units (MCUs). In scans in which the quantized coefficient values are encoded in groups (e.g., in which the quantized coefficient values for more than one component are encoded in a single MCU), the MCU defines the manner in which the components are interleaved.
To decompress a JPEG compressed data stream, the process is essentially the reverse of the compression process. First, the MCUs of the compressed data stream are decoded in an entropy decoder; then the quantized coefficient values for the components of each MCU are dequantized (i.e., multiplied) by the appropriate quantization value used during compression, and the dequantized coefficient values are then transformed into the spatial domain using an IDCT (Inverse Discrete Cosine Transform). The decompressed spatial domain data is then typically stored, at least temporarily, in a memory, where it may then be provided to a display device, such as video or television monitor, a printer or copier, etc.
As well known to those skilled in the art, during compression, sampled portions of the image are processed in a particular order or sequence; namely from left to right and from top to bottom. The blocks or arrays of component values for each of the sampled portions are transformed into the frequency domain in a similar manner. Further, the value of the DC coefficient for each component of an MCU (except for the first MCU) is expressed as a difference between the value of DC coefficient of the current component block and that of the immediately preceding component block. Because compressed images are compressed in a particular sequential order, and the values of certain coefficients of one component block are differentially encoded relative to those of a preceding block, most image decompression systems and processes decompress the compressed image in the same sequential order in which it was compressed.
In many instances it may be desired to display a previously compressed image in viewable form (e.g., projected on a display screen such as that of a television or video monitor, a PDA or cell phone screen, or printed or copied in hardcopy form, etc.) in its original orientation. However, in other instances, it may be desired that the previously compressed image be displayed in an orientation other than its original orientation. For example, images are frequently rotated by a multiple of 90° (i.e., 90°, 180°, 270° (or alternatively −90°)), whether to accommodate the capabilities of the display device (e.g., to accommodate the dimensions of a display screen or a hardcopy medium on which the image is rendered), to accommodate the desires of the viewer, or for other reasons.
U.S. Pat. Nos. 5,751,865, 5867,598, and 6,175,653, which are incorporated herein by reference in their entirety, describe various aspects relating to the compression, decompression, and/or rotation of images. The '865 patent describes how a rotation operation may be combined with a block-wise compression operation so as to produce rotated and compressed data that may be decompressed and sent to a display device to obtain a rotated image. In the '865 patent, the blocks of spatial data are rotated prior to being compressed in accordance with the JPEG standard. The '598 patent describes an alternative technique wherein the coded units (i.e., MCUs) of a JPEG compressed image corresponding to a first orientation of the image may be only partially decoded and then rotated in the transform (e.g., frequency) domain without fully decompressing the coded units. In the '598 patent, quantized coefficient matrices of a component are rotated in the transform domain and then entropy re-encoded. The entropy re-encoded data may be re-ordered to accomplish interblock rotation. The '653 patent describes the rotation and scaling of a compressed image for output to a display device having an asymmetric resolution. In the '653 patent, the coded units of a compressed image corresponding to a first orientation of the image are partially decoded, and then rotated and scaled in the transform domain. The rotated and scaled coded units are then fully decompressed, and the spatial data is placed in an appropriate location in an output buffer to achieve interblock rotation.